import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
      Scanner sc=new Scanner(System.in);
      while (sc.hasNextInt()){
         int n= sc.nextInt();
         int count = 0;
         while (n != 0){
             n = n & (n-1);
             count++;
         }
          System.out.println(count);
      }
    }
    public static void main7(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int i = 0;
        int sum = 0;
        while(i < 32){
            if(((n>>>i)&1)==1){
                sum++;
            }
            i++;
        }
        System.out.println(sum);
    }
    public static void main6(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i = sc.nextInt();
        int j = sc.nextInt();
        if (j < i) {
            int tmp=i;
            i = j;
            j = tmp;
            }
        while(j != 0){
            int tmp = j;
            j = i % j;
            i = tmp;
        }
        System.out.println("最大公约数为"+i);
    }


    public static void main5(String[] args) {
        double i = 1.0f;
        int tmp=1;
        double t = 0f;
        double sum=0f;
        while(i <= 100){
            t=(1/i)*(tmp);
            sum=t+sum;
            i++;
            tmp=-tmp;
        }
        System.out.println(sum);
    }
    public static void main4(String[] args) {
       Scanner sc=new Scanner(System.in);
       int n = sc.nextInt();
       if(n <= 100)
       {
           System.out.println(0+"到"+n+"之间没有水仙花数");
       }
       else  {
           if(n>=1000){
               n = 999;
           }
           int i = 0;
           for(i = 100;i <= n;i++){
             int t = i;
             int x = t % 10;
             t = t / 10;
             int y = t % 10;
             int z = t / 10;
             if(i==(x*x*x + y*y*y + z*z*z)) {
                 System.out.println(i);
             }
           }
       }

    }
        public static void main3(String[] args) {
            Scanner sc=new Scanner(System.in);
            while(sc.hasNextInt()){
                int n=sc.nextInt();
                for(int i=0;i<n;i++){
                    for(int j=0;j<n;j++)
                    {
                        if(i == j ||((i+j)==n-1)){
                            System.out.print("*");
                        }else{
                            System.out.print(" ");
                        }
                    }
                    System.out.println();
                }
            }
        }

    public static void main2(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int i=scanner.nextInt();
        int t = 2;
        int flag = 0;
        if(i <= 1){
            System.out.println(i+"不是素数");
        }else {
            while(t < i){
                if(i % t == 0){
                    flag =1;
                    break;
                }
                t++;
            }
            if(flag == 0){
                System.out.println(i+"是素数");
            }
            else{
                System.out.println(i+"不是素数");
            }
        }
    }
    public static void main1(String[] args) {
        int i = 1;
        int num = 0;
        while(i <= 100){
            if(i / 10 == 9||i % 10 == 9){
                num++;
            }
            i++;
        }
        System.out.println(num);
    }
}
